import java.util.Arrays;

public class test {
    public static int func(int []array,int key){
        int light=0;
        int right=array.length-1;
        int mid=(light+right)/2;
        while(light<=right){
            if(array[mid]<key){
                right=mid-1;
            }
            else if(array[mid]>key){
                light=mid+1;
            }
            else{
                return mid;
            }
        }
        return -1;
    }
    public static void main(String[] args) {
        int []array={1,2,3,4,5,6,7,8,9,10} ;
        Arrays.sort(array);
        System.out.println(Arrays.binarySearch(array,8));
    }
}
